<?php
	include("db.php");
	include("fileop.php");

	$pic_path=addfile('file');
	if($pic_path!=""){
	$id_resto=$_POST['id_resto'];
	$descfr=$_POST['descfr'];
	$descarb=$_POST['descarb'];
	
$con=mysqli_connect(DBADDR,DBUSER,DBPWD,DBNAME);
mysql_query('set names utf8'); 
// Check connection
if (mysqli_connect_errno()){
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  echo "Returning in 5 seceonds";
  header("refresh:5;url=allphoto.php?id=".$id_resto);

}
$sql = "INSERT INTO `inforesto`.`resto_pic` (`RESTO_ID`, `PIC_LOCATION`, `INTRO_FR`, `INTRO_ARB`) VALUES ('$id_resto', '$pic_path', '$descfr', '$descarb');";
mysqli_query($con,$sql);

mysqli_close($con);
echo "Upload successfully. ";}else{echo "No image uploaded.";}
?>
     <html>
	 <script language=javascript>

//设置返回到父窗口的值
function retrunValue()
{
window.returnValue=1;
window.close();
}


//-->
</script> 
	 <head></head><body>
	 <br/><input style="margin:0 auto; " type ="button" value="close" onclick="retrunValue()"/>
	 <body>
	 
	 </html>